<template>

<!-- 	<view>
		<uv-drop-down ref="dropDown" sign="dropDown_1" text-active-color="#3c9cff"
			:extra-icon="{name:'arrow-down-fill',color:'#666',size:'26rpx'}"
			:extra-active-icon="{name:'arrow-up-fill',color:'#3c9cff',size:'26rpx'}" :defaultValue="defaultValue"
			:custom-style="{padding: '0 30rpx'}" @click="selectMenu">
			<uv-drop-down-item name="order" type="2" :label="dropItem('order').label" :value="dropItem('order').value">
			</uv-drop-down-item>
			<uv-drop-down-item name="type" type="2" :label="dropItem('type').label" :value="dropItem('type').value">
			</uv-drop-down-item>
			<uv-drop-down-item name="vip_type" type="1" label='VIP文档' :value="dropItem('vip_type').value">
			</uv-drop-down-item>
		</uv-drop-down>
		<uv-drop-down-popup sign="dropDown_1" :click-overlay-on-close="true" :currentDropItem="currentDropItem"
			@clickItem="clickItem" @popupChange="change"></uv-drop-down-popup>
	</view> -->

	<view class="" style="height:100%;overflow: hidden;">


		<uv-button v-if="!sr.userinfo" text="立即登录" size="normal" @click="control_clickLogin"
			style="width: 40%;margin-top: 500rpx;margin-left: 30%;"></uv-button>

		<uv-button v-else-if="sr.userinfo.shenfen==0" text="请先申请岗位" size="normal" @click="control_clickLogin"
			style="width: 40%;margin-top: 500rpx;margin-left: 30%;"></uv-button>

		<uv-cell-group v-else>

			<uv-cell v-for="(item, index) in list" :key="index" :label="item.nickname" :title="item.title"
				:value="item.create_at" required="true" @click="goDetail2(item.id)">

			</uv-cell>
		</uv-cell-group>


	</view>

</template>
<script>
	import config from "@/config/config.js";
	import xcUniappUtils from '@/library/xcore/js/XcUniappUtils.js';
	import xcHttpUtils from '@/library/xcore/js/XcHttpUtils.js';
	import xcViewUtils from '@/library/xcore/js/XcViewUtils.js';
	import xcCloginUtils from '@/library/xcore/js/XcCloginUtils.js';
	import xcCWeixinMpLoginUtils from '@/library/xcore/js/XcCWeixinMpLoginUtils.js';
	import {
		xsStringUtils,
		xsDateUtils,
		xsArrayUtils
	} from 'xstack-for-javascript';

	export default {
		onPageScroll() {
			// 滚动后及时更新位置
			this.$refs.dropDown.init();
		},
		computed: {
			dropItem(name) {
				return (name) => {
					const result = {};
					const find = this.result.find(item => item.name === name);
					if (find) {
						result.label = find.label;
						result.value = find.value;
					} else {
						result.label = this[name].label;
						result.value = this[name].value;
					}
					return result;
				}
			},
			// 获取当前下拉筛选项
			currentDropItem() {
				return this[this.activeName];
			}
		},
		data() {
			return {
				uid:'',
				// 表示value等于这些值，就属于默认值
				defaultValue: [0, 'all', '0'],
				// 筛选结果
				result: [{
					name: 'order',
					label: '最新发布',
					value: 'new'
				}],
				// { name: 'order', label: '最新发布', value: 'new' }
				activeName: 'order',
				order: {
					label: '综合排序',
					value: 'all',
					activeIndex: 0,
					color: '#333',
					activeColor: '#2878ff',
					child: [{
						label: '综合排序',
						value: 'all'
					}, {
						label: '最新发布',
						value: 'new'
					}, {
						label: '低价优先',
						value: 'money'
					}]
				},
				type: {
					label: '文档格式',
					value: 'all',
					activeIndex: 0,
					color: '#333',
					activeColor: '#2878ff',
					child: [{
						label: '全部',
						value: 'all'
					}, {
						label: 'PDF',
						value: 'pdf'
					}, {
						label: 'WROD',
						value: 'word'
					}, {
						label: 'PPT',
						value: 'ppt'
					}]
				},
				vip_type: {
					label: 'VIP文档',
					value: 0,
					activeIndex: 0
				},

				list: [],
				config: config,
				xsStringUtils: xsStringUtils,
				xsDateUtils: xsDateUtils,
				sp: {
					id: null
				},
				sr: {
					row: [],
					userinfo: null
				},
				control: {}
			}
		},
		onLoad(options) {
			let that = this;
			that.xinit();
			that.uid = options.uid

		},
		onShow() {
			let that = this;
			xcUniappUtils.onShow(function() {
				that.public_show();
			});

			xcCloginUtils.getUserinfo(function(userinfo) {
				that.sr.userinfo = userinfo;

			});
			xcHttpUtils.gettijiaoListAll({uid:that.uid}, function(res2) {
				that.list = res2;
				console.log(11111, that.list)
			});
		},

		onPullDownRefresh() {
			let that = this;
			setTimeout(function() {
				that.public_show();
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			goDetail2(id) {

				uni.navigateTo({
					url: '/pages/csmwj/paperDetail?qid=' + id
				});
			},
			control_clickLogin() {

				uni.navigateTo({
					url: '/pages/xclogin/me'
				});
			},
			goDetail(id) {
				console.log(id)
				uni.navigateTo({
					url: '/pages/csmwj/paperDetail?qid=' + id
				});
			},
			xinit() {
				let that = this;

			},
			public_show() {
				let that = this;
			},
			public_reset() {
				let that = this;
				that.public_show();
			},
			control_switchLocale(locale) {
				let that = this;
				xcLangUtils.switchLocale(locale);
			}
		}
	}
</script>

<style lang="scss">

</style>
